﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace synjones.project.cas
{
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class method : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            string token = context.Request["token"];

            UserModel usr = context.Application[token] as UserModel;//获取token映射的用户信息
            context.Application.Remove(token); //删除缓存的token，token一次有效

            string properties = System.Configuration.ConfigurationManager.AppSettings["cas_user_properties"];
            context.Response.Write(usr.ToXMLString(true, properties.Split(new char[]{','})));//实际使用中可能需要返回xml或者json格式的用户信息
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}
